<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateBasicResourceTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('basic_resource', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('uid', false, true)->default(0)->comment('用户编号 0:表示后台上传');
            $table->char('resource_type', '10')->nullable()->comment('资源类型 picture:图片; attachment:附件; video:视频; audio:音频; download:专供下载');
            $table->integer('resource_size', false, true)->default(0)->comment('图片大小 单位 b');
            $table->string('resource_key')->default()->comment('唯一码')->unique();
            $table->string('resource_name')->nullable()->comment('资源名');
            $table->string('resource_path')->nullable()->comment('资源路径 可以为url');
            $table->string('resource_md5', 60)->nullable()->comment('md5值');
            $table->string('resource_sha1', 100)->nullable()->comment('sha1值');
            $table->char('suffix', 10)->nullable()->comment('后缀名 没有.');
            $table->tinyInteger('status')->default(99)->comment('状态 99:正常可用 0:不可用');
            $table->text('more')->nullable()->comment('扩展字段');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('basic_resource');
    }
}
